import requests

response = requests.get('http://www.baidu.com')

# 打印response得到一个字符串：<Response [200]>
print(response)

# 打印响应的内容
print(response.text)

# 发送带查询参数的get请求
params = {'key1': 'value1', 'key2': 'value2'}
response = requests.get('https://www.baidu.com/', params=params)
print(response.text)

# 设置请求头和请求超时时间
headers = {'User-Agent': 'Mozilla/5.0'}
response = requests.get('https://www.baidu.com/', headers=headers, timeout=5)
print(response.text)